/**
 * Created by MADinow on 26.10.2014.
 */

/* -----------------------------------------------------------
                MENU EVENTS MODULE
 ----------------------------------------------------------- */

define(['settings/variables', 'ui/madGenerator', 'ui/mainContent-ui',
        'ui/popup-ui', 'events/popup-events', 'jquery', 'jquery_ui'],
    function (Variables, Genny, MainContent, Popup, PopupEvents) {

        /**
         * init menubar hover event
         * @private
         */
        function _initMenubarHover(){
            $("#menubar").hover(function(){
                MainContent.blurContentScreen();
                $(this).stop(true, false).animate({opacity: 1}, 350);
            }, function(){
                MainContent.focusContentScreen();
                $(this).stop(true, false).animate({opacity: 0.85}, 350);
            });
        }

        /**
         * init the click events for all menu buttons by their ID
         * @private
         */
        function _initMenubuttonClicks(){
            $('.menubutton').bind({
                click: function(){
                    Popup.openPopup($(this).attr('id'));
                }
            });
        }

        /**
         * initializes all menu events
         * @private
         */
        function _initMenuEvents(){
            _initMenubarHover();
            _initMenubuttonClicks();
        }

        /**
         * public interface
         */
        return {

            /* functions */
            initMenuEvents: _initMenuEvents

        }

    }
);